package com.lemon.controller;
import com.lemon.domain.PageResult;
import com.lemon.domain.Result;
import com.lemon.domain.WarehousingEntryUp;
import com.lemon.domain.dto.EntryUpDto;
import com.lemon.domain.vo.TargetVo;
import com.lemon.service.WarehousingEntryUpService;
import com.lemon.service.impl.WarehousingEntryUpServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import org.springframework.beans.factory.annotation.Autowired;

import java.time.LocalDateTime;
import java.util.List;

/**
* 入库上架表(warehousing_entry_up)表控制层
*
* @author xxxxx
*/
@RestController
@RequestMapping("/warehousing_entry_up")
@RequiredArgsConstructor
public class WarehousingEntryUpController {
/**
* 服务对象
*/
    private final WarehousingEntryUpService warehousingEntryUpService;

    @GetMapping("/task")
        public Result task(Integer category){
        List<TargetVo> list =  warehousingEntryUpService.task(category);
        return Result.success(list);
    }


    @GetMapping("/{skuId}")
    public Result getList(@PathVariable Long skuId){
        List<WarehousingEntryUp> list = warehousingEntryUpService.getList(skuId);
        return Result.success(list);
    }

    @PostMapping
    public Result add(@RequestBody EntryUpDto entryUpDto){
        warehousingEntryUpService.add(entryUpDto);
        return Result.success();
    }

    @GetMapping
    public Result getPage(Integer page, Integer pageSize,Integer  status){
        PageResult pageResult =  warehousingEntryUpService.getPage(page, pageSize,status);
        return Result.success(pageResult);
    }


}
